import Cookies from 'js-cookie'


export function getToken(TokenKey) {
    if (!TokenKey) return
    return Cookies.get(TokenKey)
}

export function setToken(TokenKey, content) {
    if (!TokenKey) return
    if (typeof content !== 'string') {
        content = JSON.stringify(content)
    }
    return Cookies.set(TokenKey, content)
}

//七天过期
export function setTokenTime(TokenKey, content) {
    if (!TokenKey) return
    if (typeof content !== 'string') {
        content = JSON.stringify(content)
    }
    return Cookies.set(TokenKey, content, { expires: 7 })
}

export function removeToken(TokenKey) {
    if (!TokenKey) return
    return Cookies.remove(TokenKey)
}
